//
//  OViewController.m
//  AnchorPoint
//
//  Created by 吴高烽 on 2016/11/20.
//  Copyright © 2016年 吴高烽. All rights reserved.
//  http://www.jianshu.com/p/c26a4180b375
//  http://www.jianshu.com/p/1e4b5abbc590
/* 自定义转场
 
 
 */
#import "OViewController.h"
#import "ViewController.h"
#import "YKTimeView.h"
#import "YKAnimationPresentedProxy.h"
#import "YKAnimationDismissedProxy.h"
@interface OViewController ()<UIViewControllerTransitioningDelegate>

@end

@implementation OViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor purpleColor];
    [self setupTimeView];
}
-(void)setupTimeView{
    YKTimeView *view  = [[YKTimeView alloc ]initWithFrame:CGRectMake(10, 30, 300, 300)];
    [self.view addSubview:view];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)showAction {
    ViewController *vc = [[ViewController alloc]init];
    vc.transitioningDelegate = self ;
    vc.modalTransitionStyle = UIModalPresentationCustom ;
    [self presentViewController:vc animated:YES completion:nil];
}
//view呈现时的动画代理
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
    YKAnimationPresentedProxy *prenset = [[YKAnimationPresentedProxy alloc]init];
    return prenset ;
}
//view消失时的动画代理
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{
    YKAnimationDismissedProxy *dismiss = [[YKAnimationDismissedProxy alloc]init];
    return dismiss ;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
